<template>
  <div>
    <h2>购买成功</h2>
    <router-link to="/order">我的订单</router-link>
  </div>
</template>

<script>
export default {
  mounted() {
    let uid = localStorage.getItem("uid");
    let goodid = this.$route.query.goodid;
    let num = this.$route.query.num;
    let auth = localStorage.getItem("auth");

    let data = {
      goodid: goodid,
      uid: uid,
      num: num,
      auth: auth
    };

    this.axios({
      url: "http://127.0.0.1:8000/app03/order/",
      method: "post",
      data: data
    }).then(res => {
      alert(res.data.msg);
      if (res.data.code == 2000) {
        this.$router.push("/goods");
      }
    });
  }
};
</script>

<style>
</style>